
var DomainConfiger = function( domainRegexStr ) {
    this.domainRegexStr = domainRegexStr;
};
DomainConfiger.configs = {};
DomainConfiger.getAppName = function( domain ) {
    
    var configs = this.configs;

    for( var regexStr in configs ) {
        var regex = new RegExp(regexStr);

        if( regex.test( domain ) )
            return configs[regexStr].appName;
    }

    return false;

};



var fn = DomainConfiger.prototype;
fn.toApp = function( appName ) {

    var configs = DomainConfiger.configs;

    var thisConfig = configs[ this.domainRegexStr ] = configs[ this.domainRegexStr ] || {};

    thisConfig.appName = appName;

};

module.exports = DomainConfiger;